<template>
  <!-- action="#" -->
  <!-- :before-upload="beforeUpload" -->
  <el-upload :headers="headers" action="http://192.168.88.72:9989/back-api/configFishpondTask/feedingImportExcel" :data="data" class="upload-demo" :show-file-list="false" name="fileName" list-type="text" :on-success="upSuccess">
    <el-button style="
                              background-color: #0a5fb2;
                              border-color: #0a5fb2;
                              border-radius: 60px;
                              width: 110px;
                            " v-allow="'050101'" icon="el-icon-upload" type="success">投料导入</el-button>
  </el-upload>
</template>
<script>
export default {
  name: 'FileUpload',
  props: {
    url: { type: String, default: '' },
    data: { type: Object, default: null }
  },
  computed: {
    headers() {
      return {
        Authorization: window.localStorage.getItem('token')
      }
    }
  },
  methods: {
    requestMethod(files) { },

    upSuccess(res) {
      if (res.code == 200) {
        this.$message({
          showClose: true,
          message: res.msg,
          type: 'success'
        })

        this.$emit('onSubmit')
      } else {
        this.$message({
          showClose: true,
          message: res.msg,
          type: 'error'
        })
      }
    }
  }
}
</script>
<style lang="less" scoped>
.upload-demo {
  margin-left: 10px;
  margin-right: 10px;
  // width: 70px;
  // height: 40px;

  // background-color: #0a5fb2;
  // border-color: #0a5fb2;
  // border-radius: 60px;
  // width: 95px;
}
</style>
  